/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.uml_generator.bean;

import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.w3c.dom.Element;

import com.genia.toolbox.uml_generator.model.AbstractClassModel;
import com.genia.toolbox.uml_generator.model.AbstractJavaObject;
import com.genia.toolbox.uml_generator.model.DataTypeModel;
import com.genia.toolbox.uml_generator.model.EnumerationModel;

/**
 * contains all the non static informations needed by the generation.
 */
public interface ModelGeneratorContext
{

  /**
   * add the {@link AbstractClassModel} to the modelGenerator.
   * 
   * @param model
   *          the {@link AbstractClassModel} to add
   */
  public abstract void addClassModel(final AbstractClassModel model);



  /**
   * add the {@link DataTypeModel} model to the modelGenerator.
   * 
   * @param dataTypeModel
   *          the {@link DataTypeModel} to add
   */
  public abstract void addDataTypeModel(final DataTypeModel dataTypeModel);



  /**
   * register all elements to the list of referenceable elements. This is used
   * to be able to retrieve idref references.
   * 
   * @param elements
   *          the elements to register.
   */
  public abstract void addElements(List<Element> elements);



  /**
   * add the {@link EnumerationModel} to the model generator.
   * 
   * @param enumerationModel
   *          the {@link EnumerationModel} to add
   */
  public abstract void addEnumeration(final EnumerationModel enumerationModel);



  /**
   * getter for the classes property.
   * 
   * @return the classes
   */
  public abstract Map<String, AbstractClassModel> getClasses();



  /**
   * getter for the configuration property.
   * 
   * @return the configuration
   */
  public abstract GenerationConfiguration getConfiguration();



  /**
   * getter for the dataTypeM property.
   * 
   * @return the dataTypeM
   */
  public abstract Map<String, DataTypeModel> getDataTypes();



  /**
   * returns the {@link Set} of interfaces that have dependencies and that must
   * be declared in the Spring config file.
   * 
   * @return the {@link Set} of interfaces that have dependencies and that must
   *         be declared in the Spring config file
   */
  public abstract Set<AbstractClassModel> getDependencies();



  /**
   * return the directory associated to the package of an object.
   * 
   * @param baseDir
   *          the base directory
   * @param object
   *          the object to inspect
   * @return the directory associated to the package
   */
  public abstract File getDirectoryForPackage(File baseDir, AbstractJavaObject object);



  /**
   * return the directory associated to a package.
   * 
   * @param baseDir
   *          the base directory
   * @param packageName
   *          the package name
   * @return the directory associated to the package
   */
  public abstract File getDirectoryForPackage(File baseDir, String packageName);



  /**
   * getter for the enumM property.
   * 
   * @return the enumM
   */
  public abstract Map<String, EnumerationModel> getEnumerations();



  /**
   * getter for the errors property.
   * 
   * @return the errors
   */
  public abstract List<String> getErrors();



  /**
   * getter for the generatedSources property.
   * 
   * @return the generatedSources
   */
  public abstract List<File> getGeneratedSources();



  /**
   * returns a {@link AbstractJavaObject} knowing its identifier.
   * 
   * @param id
   *          the identifier of the object to retrieve
   * @return the {@link AbstractJavaObject} having the right identifier, or
   *         <code>null</code> if no such object exists.
   */
  public abstract AbstractJavaObject getObject(String id);



  /**
   * returns the real element corresponding to the one given in parameter. This
   * is useful when element contains an idref.
   * 
   * @param element
   *          the element that is a reference
   * @return the referenced element
   */
  public abstract Element getRealElement(Element element);



  /**
   * setter for the configuration property.
   * 
   * @param configuration
   *          the configuration to set
   */
  public abstract void setConfiguration(GenerationConfiguration configuration);

}
